{layout name="layout" /}
<script type="text/javascript" src="/static/layui/jquery.min.js"></script>
<fieldset class="layui-elem-field">
    <legend>事件代码</legend>
    <div class="layui-field-box">
        文件名请按照驼峰命名规范命名<br>
        创建事件的时候，会同时创建对应的监听事件、订阅事件<br>
    </div>
</fieldset>
{empty name="code"}
<form class="layui-form" action="{:url('event_code')}" style="width: 30%;">
    <div class="layui-form-item">
        <label class="layui-form-label">事件文件名</label>
        <div class="layui-input-block">
            <input type="text" name="event_name" class="layui-input">
            <span style="color: red;">必填</span>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">生成事件代码</button>
        </div>
    </div>
</form>
{else/}
<h3>事件</h3><br>
<form class="layui-form" action="{:url('create_event')}">
    <div class="layui-input-inline">
        <label>事件文件名</label>
        <input type="text" name="event_name" value="{$event_name}" class="layui-input">
    </div>
    <button class="layui-btn" lay-submit>生成事件文件</button>
</form>
<br/>
<textarea id="code" class="width" style="height: 550px;">
{$content}
</textarea>
{/empty}

